clear all
cd "C:\Users\mdebus\Dropbox\dezim_mzes\Ukrainepapier\replication_revision_5Feb2025"
log using sanctions_revision, replace
use dezim_survey_2ndwave.dta, clear

* generate migrant background 
tab MigHin
tab MigHin, nol

gen mighin_no = 0 
replace mighin_no = 1 if MigHin==1

gen mighin_rus = 0 
replace mighin_rus = 1 if MigHin==2

gen mighin_tur = 0 
replace mighin_tur = 1 if MigHin==3

gen mighin_oth = 0 
replace mighin_oth = 1 if MigHin==4


* religious denomination

tab V_S3
tab V_S3, nol
tab V_S3O

gen muslim = 0
replace muslim = 1 if V_S3 == 1 | V_S3==2

gen ev = 0
replace ev = 1 if V_S3==6

gen rk = 0
replace rk = 1 if V_S3==8

gen ev_frei = 0
replace ev_frei = 1 if V_S3 == 7

gen kflos = 0
replace kflos = 1 if V_S3==13

gen schiit = 0
replace schiit=1 if V_S3==1

gen sunnit = 0
replace sunnit = 1 if V_S3==2

gen alevi = 0
replace alevi=1 if V_S3==3

gen konfessionslos = 0
replace konfessionslos = 1 if V_S3==13

* Education

tab V_S5
tab V_S5, nol

gen abitur_studium = 0
replace abitur_studium=1 if V_S5 == 7 | V_S5==8


* German citizenship

tab V_M3C1
tab V_M3C1, nol

gen citizenship_german= 0
replace citizenship_german=1 if V_M3C1==1



* satisfaction with democracy

tab V_PU4A
tab V_PU4A, nol
recode V_PU4A (97=.) (98=.)

rename V_PU4A satisfaction_democracy

* gender
tab V_S1
tab V_S1, nol
gen female = 0
replace female =1 if V_S1==1

* age
tab ALTER_BE, nol
tab ALTER_BE, mis

tab S2A

gen age = 2022-S2A
tab age, mis
replace age=. if age<0

*German state (Bundesland): east - west

tab BLAND
tab BLAND, nol

gen east = 0 
replace east = 1 if BLAND>11

* year of birth

tab ALTER_BE
tab ALTER_BE, nol

destring ALTER_BE, replace
tab ALTER_BE, mis

gen alter=ALTER_BE
tab alter, mis 
gen gebjahr = 2022-alter
tab gebjahr, mis

* Probability to vote for the left, greens, afd 

gen lin_electionprob = .
replace lin_electionprob = 1 if  V_REP3A_F==6
replace lin_electionprob = 2 if  V_REP3A_F==5
replace lin_electionprob = 3 if  V_REP3A_F==4
replace lin_electionprob = 4 if  V_REP3A_F==3
replace lin_electionprob = 5 if  V_REP3A_F==2
replace lin_electionprob = 6 if  V_REP3A_F==1

tab lin_electionprob MigHin, col

gen gru_electionprob = .
replace gru_electionprob = 1 if  V_REP3A_G==6
replace gru_electionprob = 2 if  V_REP3A_G==5
replace gru_electionprob = 3 if  V_REP3A_G==4
replace gru_electionprob = 4 if  V_REP3A_G==3
replace gru_electionprob = 5 if  V_REP3A_G==2
replace gru_electionprob = 6 if  V_REP3A_G==1

tab gru_electionprob MigHin, col

gen afd_electionprob = . 
replace afd_electionprob = 1 if  V_REP3A_D==6
replace afd_electionprob = 2 if  V_REP3A_D==5
replace afd_electionprob = 3 if  V_REP3A_D==4
replace afd_electionprob = 4 if  V_REP3A_D==3
replace afd_electionprob = 5 if  V_REP3A_D==2
replace afd_electionprob = 6 if  V_REP3A_D==1

tab afd_electionprob


* dependent variable: sanctions against russia
tab V_UA1

tab V_UA1, nol

recode V_UA1 (97=.) (98=.)
tabstat V_UA1, by (MigHin) stat(mean sd N)

rename V_UA1 sanktionen_ukraine

tab sanktionen_ukraine MigHin, col

tab V_PID1
tab V_PID1, nol

* ethnic identity

tab V_ID2C1
tab V_ID2C4

gen eth_identität = .
*german
replace eth_identität = 0 if V_ID2C1==1
*turkish
replace eth_identität = 1 if V_ID2C4==1
*russian
replace eth_identität = 2 if V_ID2C6==1
*russian-german
replace eth_identität = 3 if V_ID2C7==1
* other (black, kurdish, other)
replace eth_identität = 6 if V_ID2C8==1  | V_ID2C9==1 | V_ID2C5==1 
* none of these 
replace eth_identität = 7 if V_ID2C10==1
* jewish
replace eth_identität = 4 if V_ID2C2==1 
* muslim
replace eth_identität = 5 if V_ID2C3==1 

tab eth_identität

tab eth_identität, mis

label define eth_identität 0 German
label define eth_identität 1 Turkish, add
label define eth_identität 2 Russian, add
label define eth_identität 3 "Russian-German", add
label define eth_identität 6 "Other", add
label define eth_identität 4 "Jewish", add
label define eth_identität 5 "Muslim", add
label define eth_identität 7 "None of these", add

label list eth_identität
label values eth_identität eth_identität

tab MigHin
tab MigHin, nol

label define MigHin 1.00 "No migrant background"
label define MigHin 2.00 "Russian migrant background", add
label define MigHin 3.00 "Turkish migrant background", add
label define MigHin 4.00 "Other migrant background", add

label list MigHin
label values MigHin MigHin

* keep respondents with German citizenship only yes/no
tab citizenship_german
*keep if citizenship_german==1

gen citizenship_nongerman = 0
replace citizenship_nongerman = 1 if citizenship_german==0


label var satisfaction_democracy "Satisfaction with democracy"
label var alter "Age"
label var muslim "Muslim"
label var ev "Protestant"
label var rk "Roman-Catholic"
label var ev_frei "Evangelical"
label var afd_electionprob "Probability to vote AfD"
label var gru_electionprob "Probability to vote Green"
label var lin_electionprob "Probability to vote Left"
label var abitur_studium "High school / university degree"
label var east "East Germany"
label var female "Female"
label var citizenship_nongerman "No German citizenship"


*********
* Analysis
*********

tab eth_identität
tab eth_identität, nol mis

* Figures A1 and A2

graph hbox sanktionen_ukraine, over(MigHin) 
graph hbox sanktionen_ukraine, over(eth_identität) 


* Table A1 and Figures 1 and 2

* obj migrant background
eststo clear
eststo: reg sanktionen_ukraine ///
i.MigHin alter ///
afd_electionprob ///
lin_electionprob ///
gru_electionprob ///
 ev rk ev_frei citizenship_nongerman ///
abitur_studium east female 

estimates store model1
coefplot model1  , drop(_cons) xline(0) level(95)

margins MigHin

marginsplot ///
	, xdimension(MigHin) ///
	ytitle("Against (1) vs. in favour (11) of sanctions against Russia") ///
	ylabel(1(1)11) ///
	xtitle("Migrant background") ///
	xlabel(0.5 "" 1 "None" 2 "Russian" 3 "Turkish" 4 "Other" 4.5 "") ///
		plotopts(connect(none)) ///
		title("")

		
* ethnic identity

*eststo clear
eststo: reg sanktionen_ukraine ///
i.eth_identität alter ///
afd_electionprob ///
lin_electionprob ///
gru_electionprob ///
 ev rk ev_frei citizenship_nongerman ///
abitur_studium east female 

estimates store model3
coefplot model3 , drop(_cons) xline(0) level(95)

margins eth_identität

marginsplot ///
	, xdimension(eth_identität) ///
	ytitle("Against (1) vs. in favour (11) of sanctions against Russia") ///
	ylabel(1(1)11) ///
	xtitle("Subjective ethnic identity") ///
	xlabel(-0.5 "" 0 "German" 1 "Turkish" 2 "Russian" 3 "Russian-German" 4 "Jewish" 5 "Muslim" 6 "Other" 7 "None of these" 7.5 "") ///
		plotopts(connect(none)) ///
		title("")
		
		
esttab using "C:\Users\mdebus\Dropbox\dezim_mzes\Ukrainepapier\table_positionsonsanctions.rtf" , replace ///
	abs b(3) se(3) ///
	star(+ 0.10 * 0.05 ** 0.01) ///
	aic ///
	scalars("ll Log pseudolikelihood") ///
	nonumbers /// 
	nogaps ///
	compress ///
	coeflabels(_cons "Constant" ///
	satisfaction_democracy "Satisfaction with democracy" ///
	citizenship_german "German" ///
	alter "Age" ///
	lire_self "Left-right position" ///
	citizenship_nongerman "No German citizenship" ///
	muslim "Muslim" ///
	ev "Protestant" ///
	ev_frei "Evangelical" ///
	age_below40y "Age: below 40 years" ///
	rk "Roman-Catholic" ///
	afd_electionprob "Probability to vote AfD" ///
	lin_electionprob "Probability to vote Left" ///
	gru_electionprob "Probability to vote Green" ///
	abitur_studium "High school / university degree" ///
	east "East Germany" ///
	female "Female") ///
	nonotes addnotes("Note: Numbers in parentheses are standard errors. Reference category are respondents without a migrant background. Significance levels: + = p ≤ 0.1; * = p ≤ 0.05; ** = p ≤ 0.01.")

	
***Table A2: interaction effect age * ethnic background
	

* obj migrationshintergrund
eststo clear
eststo: reg sanktionen_ukraine ///
i.MigHin##c.alter ///
afd_electionprob ///
lin_electionprob ///
gru_electionprob ///
 ev rk ev_frei citizenship_nongerman ///
abitur_studium east female 

estimates store model1
coefplot model1  , drop(_cons) xline(0) level(95)


margins MigHin, at(alter=(18(10)78))
marginsplot, level(95) x(alter) recast(line) xlabel(18(10)78) ylabel(1(1)11) 	ytitle("Against (1) vs. in favour (11) of sanctions against Russia") 


		
* ethnische identität

*eststo clear
eststo: reg sanktionen_ukraine ///
i.eth_identität##c.alter ///
afd_electionprob ///
lin_electionprob ///
gru_electionprob ///
 ev rk ev_frei citizenship_nongerman ///
abitur_studium east female 

estimates store model3
coefplot model3 , drop(_cons) xline(0) level(95)

margins eth_identität, at(alter=(18(10)78))		
marginsplot, level(95) x(alter) recast(line) xlabel(18(10)78) ylabel(1(1)11) 	ytitle("Against (1) vs. in favour (11) of sanctions against Russia") 
		
		
esttab using "C:\Users\mdebus\Dropbox\dezim_mzes\Ukrainepapier\table_positionsonsanctions_ie_alter.rtf" , replace ///
	abs b(3) se(3) ///
	star(+ 0.10 * 0.05 ** 0.01) ///
	aic ///
	scalars("ll Log pseudolikelihood") ///
	nonumbers /// 
	nogaps ///
	compress ///
	coeflabels(_cons "Constant" ///
	satisfaction_democracy "Satisfaction with democracy" ///
	alter "Age" ///
	lire_self "Left-right position" ///
	muslim "Muslim" ///
	ev "Protestant" ///
	ev_frei "Evangelical" ///
	age_below40y "Age: below 40 years" ///
	rk "Roman-Catholic" ///
	afd_electionprob "Probability to vote AfD" ///
	lin_electionprob "Probability to vote Left" ///
	gru_electionprob "Probability to vote Green" ///
	abitur_studium "High school / university degree" ///
	citizenship_nongerman "No German citizenship" ///
	east "East Germany" ///
	female "Female") ///
	nonotes addnotes("Note: Numbers in parentheses are standard errors. Reference category are respondents without a migrant background. Significance levels: + = p ≤ 0.1; * = p ≤ 0.05; ** = p ≤ 0.01.")
	
***Table A3: interaction effect east-west Germany
	
	
* obj migrationshintergrund
eststo clear
eststo: reg sanktionen_ukraine ///
i.MigHin##i.east ///
afd_electionprob ///
lin_electionprob ///
gru_electionprob ///
 ev rk ev_frei citizenship_nongerman ///
abitur_studium alter female 

estimates store model1
coefplot model1  , drop(_cons) xline(0) level(95)

margins MigHin, over(east)

	
marginsplot ///
	, ///
	bydimension(east) ///
		plotopts(connect(none)) ///
		title("") ///
		xlabel(1 "None" 2 "Russian" 3 "Turkish" 4 "Other", notick) ///
		xsize(4) ///
		xtitle(" ") ///
		ylabel(1 "" 2 "" 3 "" 4 "" 5 "" 6 "" 7 "" 8 "" 9 "" 10 "" 11 "",angle(0)) ///
		ytitle("") ///
		plotregion(style(none) istyle(none)) ///
		plot1opts(lcolor(black) lwidth(thick)) ///
		level(95) ///
		legend(order(1 "Did not vote SPD in 2013" 2 "Voted SPD in 2013") position(6) region(style(none)))

		
		
* ethnische identität

*eststo clear
eststo: reg sanktionen_ukraine ///
i.eth_identität##i.east ///
afd_electionprob ///
lin_electionprob ///
gru_electionprob ///
 ev rk ev_frei citizenship_nongerman ///
abitur_studium alter female 

estimates store model3
coefplot model3 , drop(_cons) xline(0) level(95)

margins eth_identität, over(east)

	
marginsplot ///
	, ///
	bydimension(east) ///
		plotopts(connect(none)) ///
		title("") ///
		xlabel(0 "German" 1 "Turkish" 2 "Russian" 3 "Russian-German" 4 "Jewish" 5 "Muslim" 6 "Other" 7 "None of these", notick) ///
		xsize(4) ///
		xtitle(" ") ///
		ylabel(1 "" 2 "" 3 "" 4 "" 5 "" 6 "" 7 "" 8 "" 9 "" 10 "" 11 "",angle(0)) ///
		ytitle("") ///
		plotregion(style(none) istyle(none)) ///
		plot1opts(lcolor(black) lwidth(thick)) ///
		level(95) ///
		legend(order(1 "Did not vote SPD in 2013" 2 "Voted SPD in 2013") position(6) region(style(none)))


		
esttab using "C:\Users\mdebus\Dropbox\dezim_mzes\Ukrainepapier\table_positionsonsanctions_ie_east.rtf" , replace ///
	abs b(3) se(3) ///
	star(+ 0.10 * 0.05 ** 0.01) ///
	aic ///
	scalars("ll Log pseudolikelihood") ///
	nonumbers /// 
	nogaps ///
	compress ///
	coeflabels(_cons "Constant" ///
	satisfaction_democracy "Satisfaction with democracy" ///
	alter "Age" ///
	lire_self "Left-right position" ///
	muslim "Muslim" ///
	ev "Protestant" ///
	ev_frei "Evangelical" ///
	age_below40y "Age: below 40 years" ///
	rk "Roman-Catholic" ///
	afd_electionprob "Probability to vote AfD" ///
	lin_electionprob "Probability to vote Left" ///
	gru_electionprob "Probability to vote Green" ///
	abitur_studium "High school / university degree" ///
	east "East Germany" ///
	female "Female") ///
	nonotes addnotes("Note: Numbers in parentheses are standard errors. Reference category are respondents without a migrant background. Significance levels: + = p ≤ 0.1; * = p ≤ 0.05; ** = p ≤ 0.01.")
	

	
*** Table A4: interaction with propensity to vote afd
		
	
* obj migrationshintergrund
eststo clear
eststo: reg sanktionen_ukraine ///
i.MigHin##c.afd_electionprob ///
lin_electionprob ///
gru_electionprob ///
 ev rk ev_frei citizenship_nongerman ///
abitur_studium east female alter

estimates store model1
coefplot model1  , drop(_cons) xline(0) level(95)

margins MigHin, at(afd_electionprob=(1(1)6))
marginsplot, level(95) x(afd_electionprob) recast(line) xlabel(1(1)6) 

		
* ethnische identität

*eststo clear
eststo: reg sanktionen_ukraine ///
i.eth_identität##c.afd_electionprob ///
lin_electionprob ///
gru_electionprob ///
 ev rk ev_frei citizenship_nongerman ///
abitur_studium east female alter

estimates store model3
coefplot model3 , drop(_cons) xline(0) level(95)

margins eth_identität, at(afd_electionprob=(1(1)6))
marginsplot, level(95) x(afd_electionprob) recast(line) xlabel(1(1)6) 

	
		
esttab using "C:\Users\mdebus\Dropbox\dezim_mzes\Ukrainepapier\table_positionsonsanctions_ie_afd.rtf" , replace ///
	abs b(3) se(3) ///
	star(+ 0.10 * 0.05 ** 0.01) ///
	aic ///
	scalars("ll Log pseudolikelihood") ///
	nonumbers /// 
	nogaps ///
	compress ///
	coeflabels(_cons "Constant" ///
	satisfaction_democracy "Satisfaction with democracy" ///
	alter "Age" ///
	lire_self "Left-right position" ///
	muslim "Muslim" ///
	ev "Protestant" ///
	ev_frei "Evangelical" ///
	age_below40y "Age: below 40 years" ///
	rk "Roman-Catholic" ///
	afd_electionprob "Probability to vote AfD" ///
	lin_electionprob "Probability to vote Left" ///
	gru_electionprob "Probability to vote Green" ///
	abitur_studium "High school / university degree" ///
	east "East Germany" ///
	female "Female") ///
	nonotes addnotes("Note: Numbers in parentheses are standard errors. Reference category are respondents without a migrant background. Significance levels: + = p ≤ 0.1; * = p ≤ 0.05; ** = p ≤ 0.01.")
	
	log close
	***